package com.itheima.qingcheng.utils;

/**
 * @author ghy
 * @version V1.0
 * @date 2025-01-19 11:22
 */
public class ThreadLocalUtils {

    /**
     * ThreadLocal对象，只要一份
     */
    private static final ThreadLocal<String> THREAD_LOCAL = new ThreadLocal<>();

    /**
     * 设置数据
     * @param username
     */
    public static void set(String username){
        THREAD_LOCAL.set(username);
    }

    /**
     * 获取数据
     * @return
     */
    public static String get(){
        return THREAD_LOCAL.get();
    }

    /**
     * 移除数据
     */
    public static void remove(){
        THREAD_LOCAL.remove();
    }

}
